home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2927 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c++,comp.lang.c
  4. Subject: Re: Hungarian notation
  5. Date: Sat, 20 Jan 1996 13:51:36 GMT
  6. Organization: Netcom
  7. Message-ID: <3100f0ac.134780672@nntp.ix.netcom.com>
  8. References: <4dhkae$an9@blackice.winternet.com> <821890870snz@genesis.demon.co.uk> <30fd5306.3171520@nntp.ix.netcom.com> <822101689snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: ix-dc7-13.ix.netcom.com
  10. X-NETCOM-Date: Sat Jan 20  5:51:21 AM PST 1996
  11. X-Newsreader: Forte Agent .99c/16.141
  12.  
  13. Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
  14.  
  15. > In article <30fd5306.3171520@nntp.ix.netcom.com>
  16. >            miker3@ix.netcom.com "Mike Rubenstein" writes:
  17. > >I'm sure Lawrence is aware of this, but it's worth noting that while
  18. > >casting to long double is almost certainly safe in that it will not
  19. > >cause damage, it may not print out anything useful.  It's possible
  20. > >that time_t is an integral type that cannot be represented exactly as
  21. > >a long double and the least significant bits, that are lost in the
  22. > >conversion, may be significant.
  23. > As Dan has pointed out long double is the only type you can use and be
  24. > sure that it doesn't result in undefined behaviour. While loss of
  25. > precision is possible the chances of this happening in practice are small.
  26. > Of course you have to answer what the use is for printing out a time_t
  27. > value. Most likely that is for debugging or it assumes a particular
  28. > format. At any rate the result is inherently system specific.
  29.  
  30. This is true only if you accept that any integral type can be
  31. converted to long double.  I find Dan's argument unconvincing.
  32.  
  33. Of course, as I pointed out, it would be a pretty wierd implementation
  34. in which a value for an integral type cannot be converted to long
  35. double, but I don't see where the standard forbids such an
  36. implementation.
  37.  
  38. Michael M Rubenstein
  39.